<?php
include_once( 'Include/init.php' );

$urls = isset($_GET['urls']) ? trim($_GET['urls'], '/') : 'Index/Show';

if (isset($_GET['urls'])) unset($_GET['urls']);

$params = explode('/', $urls);
//处理get
$count = count($params);
for ($i=0; $i<$count; $i=$i+2){
	if ($i<2){
		$ctrName = ucfirst(isset($params[0]) ? $params[0] : 'Index');
		$mtdName = ucfirst(isset($params[1]) ? $params[1] : 'Show');
	}else{
		$_GET[$params[$i]] = isset($params[$i+1]) ? $params[$i+1] : null;
	}
}
//调用接口
$filename = ROOT_DIR . "Controllers/{$ctrName}.php";

if (!file_exists($filename)){
	exit('404');
}
require_once $filename;

$ctrIst = new $ctrName();

$ctrIst->$mtdName();
